
package com.source.hotelbath.base;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import java.lang.reflect.Field;

public abstract class BaseFragment extends Fragment implements OnClickListener {
    protected LayoutInflater mLayoutInflater;
    protected boolean isTopShowing;
    private boolean isHidden;
    private boolean isResume;
    protected boolean isViewCreated = false;

    public BaseFragment() {
    }

    public void onCreate(Bundle var1) {
        super.onCreate(var1);
        this.beforeCreate();
    }

    public View onCreateView(LayoutInflater var1, ViewGroup var2, Bundle var3) {
        this.mLayoutInflater = var1;
        View var4 = this.createView(this.mLayoutInflater, var2, var3);
        this.isViewCreated = true;
        return var4;
    }

    public void onActivityCreated(Bundle var1) {
        super.onActivityCreated(var1);
//        this.bindView(var1);
        this.afterCreate();
    }

    protected void beforeCreate() {
    }

    protected abstract View createView(LayoutInflater var1, ViewGroup var2, Bundle var3);


    protected void afterCreate() {
    }

    public void onSaveInstanceState(Bundle var1) {
        super.onSaveInstanceState(var1);
        this.isTopShowing = false;
    }

    public void onHiddenChanged(boolean var1) {
        super.onHiddenChanged(var1);
        this.isHidden = var1;
        if(!this.isHidden && this.isResume) {
            this.isTopShowing = true;
        } else {
            this.isTopShowing = false;
        }

    }

    public void onResume() {
        super.onResume();
        this.isResume = true;
        if(!this.isHidden && this.isResume) {
            this.isTopShowing = true;
        } else {
            this.isTopShowing = false;
        }

    }

    public void onPause() {
        super.onPause();
        this.isResume = false;
        if(!this.isHidden && this.isResume) {
            this.isTopShowing = true;
        } else {
            this.isTopShowing = false;
        }

    }

    public void onStop() {
        super.onStop();
        this.isResume = false;
        if(!this.isHidden && this.isResume) {
            this.isTopShowing = true;
        } else {
            this.isTopShowing = false;
        }

    }

    public void onDestroyView() {
        ViewGroup var1 = (ViewGroup)this.getView();
        if(var1 != null) {
            var1.removeAllViews();
        }

        this.isTopShowing = false;
        super.onDestroyView();
    }

    public void onClick(View var1) {
    }

    public boolean onBackPress() {
        return false;
    }

    public void onDetach() {
        super.onDetach();

        try {
            Field var1 = Fragment.class.getDeclaredField("mChildFragmentManager");
            var1.setAccessible(true);
            var1.set(this, (Object)null);
        } catch (NoSuchFieldException var2) {
            var2.printStackTrace();
        } catch (IllegalAccessException var3) {
            var3.printStackTrace();
        }

    }
}
